package com.ajk.server.dao;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import com.ajk.server.dao.provider.DiseaseBodypartRelProvider;
import com.ajk.server.model.DiseaseBodypartRel;
import com.ajk.server.model.query.DiseaseBodypartRelQuery;
/**
 * 疾病-身体部位关系表  <br>
 * r_disease_bodypart <br>
 * v1.0 2016-05-01
 */
 public interface DiseaseBodypartRelMapper {
 	
 	/**
 	*根据id删除 疾病-身体部位关系表
 	*/
 	@Delete("delete from r_disease_bodypart where id=#{id}")
 	public Integer deleteById(Integer id);
 	
 	/**
 	* 批量新增 疾病-身体部位关系表
 	*/
 	@InsertProvider(method="batchInsert",type=DiseaseBodypartRelProvider.class)
	@Options(useGeneratedKeys=true,keyColumn="id",keyProperty="list[0].id")
 	public Integer batchInsert(List<? extends DiseaseBodypartRel> diseaseBodypartRels);
 	
 	/**
 	* 新增 疾病-身体部位关系表
 	*/
 	@InsertProvider(method="insert",type=DiseaseBodypartRelProvider.class)
	@Options(useGeneratedKeys=true)
 	public Integer insert(DiseaseBodypartRel domain);
 
 	
 	/**
 	*更新 疾病-身体部位关系表
 	*/
 	@UpdateProvider(method="update",type=DiseaseBodypartRelProvider.class)
 	public Integer update(DiseaseBodypartRel domain);
 	
 	/**
 	*根据ID查询 疾病-身体部位关系表
 	*/
	@Select("select * from r_disease_bodypart where id=#{id}")
	public DiseaseBodypartRel findById(Integer id);
	
	/**
 	*通过query 查询 疾病-身体部位关系表
 	*/
 	@SelectProvider(method="findByQuery",type=DiseaseBodypartRelProvider.class)
 	public List<DiseaseBodypartRel> findByQuery(DiseaseBodypartRelQuery query);
 	
 	/**
 	*通过query count总条数
 	*/
 	@SelectProvider(method="countByQuery",type=DiseaseBodypartRelProvider.class)
 	public Integer countByQuery(DiseaseBodypartRelQuery query);
 	
 	/**
 	* 通过ids查询
 	*/
 	@SelectProvider(method="findByIds",type=DiseaseBodypartRelProvider.class)
 	public List<DiseaseBodypartRel> findByIds(List<Integer> ids);
 	
	@Select("select * from r_disease_bodypart where in_used=1")
	public List<DiseaseBodypartRel> findAll();
	
	@Select("select * from r_disease_bodypart where disease_id=#{diseaseId}")
 	public List<DiseaseBodypartRel> findByDiseaseId(Integer diseaseId);
}	